import random
from utils.handle_db import orcl

class HandlePhone:
    def random_phone(self):
        phone = random.randint(80000000, 89999999)
        return phone
    def get_phone(self):
        while True:
            phone = self.random_phone()
            check_phone_sql = f"select * from LITEMAIN_UAT.SUPER_APP_USER where MOBILEPHONE={phone}"
            db_result = orcl.get_db_one_data(sql=check_phone_sql)
            if db_result:
                continue
            else:
                return phone


if __name__ == '__main__':
    test = HandlePhone()
    phone = test.get_phone()
    print(phone)